home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
LANG
/
C
/
LIB
/
UNIXLIB37B
/
!UnixLib37
/
src
/
c
/
memcmp
< prev
next >
Wrap
Text File
|
1996-11-09
|
2KB
|
75 lines
/****************************************************************************
*
* $Source: /unixb/home/unixlib/source/unixlib37/src/c/RCS/memcmp,v $
* $Date: 1996/10/30 21:58:59 $
* $Revision: 1.2 $
* $State: Rel $
* $Author: unixlib $
*
* $Log: memcmp,v $
* Revision 1.2 1996/10/30 21:58:59 unixlib
* Massive changes made by Nick Burret and Peter Burwood.
*
* Revision 1.1 1996/04/19 21:26:42 simon
* Initial revision
*
***************************************************************************/
static const char rcs_id[] = "$Id: memcmp,v 1.2 1996/10/30 21:58:59 unixlib Rel $";
#include <string.h>
int
memcmp (const void *s1, const void *s2, size_t n)
{
register unsigned char *_s1 = (unsigned char *) s1, *_s2 = (unsigned char *) s2;
while (n & 0x07)
{
if (*_s1 != *_s2)
goto differs;
_s1++, _s2++;
n--;
}
n >>= 3;
while (n)
{
if (*_s1 != *_s2)
goto differs;
_s1++, _s2++;
if (*_s1 != *_s2)
goto differs;
_s1++, _s2++;
if (*_s1 != *_s2)
goto differs;
_s1++, _s2++;
if (*_s1 != *_s2)
goto differs;
_s1++, _s2++;
if (*_s1 != *_s2)
goto differs;
_s1++, _s2++;
if (*_s1 != *_s2)
goto differs;
_s1++, _s2++;
if (*_s1 != *_s2)
goto differs;
_s1++, _s2++;
if (*_s1 != *_s2)
goto differs;
_s1++, _s2++;
n--;
}
if (n == 0)
return 0;
differs:
return (*_s1 - *_s2);
}
int bcmp (const void *s1, const void *s2, size_t n)
{
return memcmp (s1, s2, n);
}